<?php
class Adminmain extends Base_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->model('adminmain_model');
    }

    public function index()
    {
        $data['dau']=$this->adminmain_model->getCommDau();
        $data['share']=$this->adminmain_model->getCommDshare();
        $data['question']=$this->adminmain_model->getQuestionCount();
        $data['pay']=$this->adminmain_model->getCommDpay();
        $data['user']=$this->adminmain_model->getUserCount();
        $data['sign']=$this->adminmain_model->getCommDsign();
        $content=$this->load->view('admin/stat',$data,true);
        echo $this->getAdminView($content);
    }

    public function logout()
    {
        $this->load->helper('cookie');
        $this->load->helper('url');
        if (!isset($_SESSION)) session_start();
        $_SESSION = null;
        if (isset($_COOKIE[session_name()])){
            set_cookie(session_name(),'',time()-3600);
        }
        session_destroy();
        redirect(site_url('admin/adminlogin'));
    }
}